package com.mnyc.controller;

import com.mnyc.model.Student;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("server")
public class ServerController {
    @GetMapping("get")
    public String getFunc(@RequestParam(value = "name") String name) {
        return "get --- " + name;
    }

    @PostMapping("post")
    public Student PostFunc(@RequestParam(value = "remark") String remark, @RequestBody Student student) {
        student.setRemark(remark);
        return student;
    }


    @PutMapping("put")
    public Student putFunc(@RequestParam(value = "remark") String remark, @RequestBody Student student) {
        student.setRemark(remark);
        return student;
    }

    @DeleteMapping("delete")
    public String deleteFunc(@RequestParam(value = "remark") String name) {
        return "delete --- " + name;
    }


    @PostMapping("path/{remark}")
    public Student pathFunc(@PathVariable(value = "remark") String remark, @RequestBody Student student) {
        student.setRemark(remark);
        return student;
    }
}
